import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
export type BannerResult = {
  page: number;
  pagesize: number;
  success: boolean;
  code: number;
  token: string;
  msg: string;
  data: {
    data: any[];
    total: number;
    page: number;
    pagesize: number;
  };
};
/** 人员列表*/
export const getAdminManageList = (data?: object) => {
  return http.request<BannerResult>(
    "get",
    baseUrlApi(
      `admin/people/list?page=${data.page}&pagesize=${data.pagesize}&name=${data.name}&phone=${data.phone}`
    ),
    {
      data
    }
  );
};

//人员添加
export const peopleInsert = (data?: object) => {
  return http.request<BannerResult>("post", baseUrlApi(`admin/people/insert`), {
    data
  });
};
//人员修改
export const peopleUpdate = (data?: object) => {
  return http.request<BannerResult>("post", baseUrlApi(`admin/people/update`), {
    data
  });
};
//人员删除
export const peopleDelete = (data?: object) => {
  return http.request<BannerResult>("post", baseUrlApi(`admin/people/delete`), {
    data
  });
};

// 公司添加
export const companyInsert = (data?: object) => {
  return http.request<BannerResult>(
    "post",
    baseUrlApi(`admin/company/insert`),
    {
      data
    }
  );
};
// 公司修改
export const companyUpdate = (data?: object) => {
  return http.request<BannerResult>(
    "post",
    baseUrlApi(`admin/company/update`),
    {
      data
    }
  );
};
